Skip to content

Conversation

@saifsultanc
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2851510985/78218

Summary

In all other cases, if no source_field_id is defined, Populate Date defaults to today. But if a field-based modifier is used, it doesn't do this and the snippet just doesn't work.

So this works, to populate today +1 day:

new GW_Populate_Date( array(
	'form_id'         => 39,
	'target_field_id' => 6,
	'modifier'        => '+1 day'
) );

But this doesn't work to populate today +n days:

new GW_Populate_Date( array(
	'form_id'         => 1895,
	'target_field_id' => 2,
	'modifier'        => array(
		'type'     => 'field',
		'inputId'  => 3,
		'modifier' => '+{0} days',
	),
) );

This update ensures the fix. Loom: https://www.loom.com/share/7980b5df520848b2a76a278960407789

…orking when source field ID wasn't provided.
@saifsultanc saifsultanc changed the title gw-populate-date.php: Fixed an issue with the date population not working when source field ID wasn't provided. gw-populate-date.php: Added support for date population when source field ID wasn't provided. Feb 28, 2025
Copy link
Contributor

@claygriffiths claygriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! S&M since you updated PR title

@saifsultanc saifsultanc merged commit 45e73a5 into master Mar 1, 2025
4 of 5 checks passed
@saifsultanc saifsultanc deleted the saif/fix/78511-fix-populate-date branch March 1, 2025 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants